#ifndef __Time_H__
#define __Time_H__
/************************************************************************************/
#include".\type.h"

void Blink_Run(void *para);
void Clock_Rtc24Run(void *para);
void Clock_Rtc12Run(void *para);
void Clock_AlarmRun(void *para);




#define ENABLE_SYSTICK       1
#if(ENABLE_SYSTICK > 0) //0327
//    #include"..\library\mcu_system.h"
    #define  CriticalEnter()   NVIC_DisableIRQ(CTIM0_IRQn);//NVIC_DisableIRQ(TMR0_IRQn)    
    #define  CriticalExit()    NVIC_EnableIRQ(CTIM0_IRQn); //NVIC_EnableIRQ(TMR0_IRQn)
#endif


enum 
{
    TIMER_ID_COMMON = 0,
    TIMER_ID_SCENE_TICK,  
    TIMER_ID_RTC,
    TIMER_ID_BLINK,
    TIMER_ID_WORK_TIME,
    TIMER_ID_FAN,
    TIMER_ID_ADD_WATER,
    TIMER_ID_TEMP,
	  TIMER_ID_DELAY_LAMP,
//  	TIMER_ID_TASK,
//	  TIMER_ID_ORDER_WORK_TIME,
	  TIMER_ID_FLAMEOUT,
    TIMER_ID_DELAY,	
	  TIMER_ID_Wifidelay,
    
	TIMER_ID_MAX,
};

#define TIMER_UNIT           5  
#define TM_COMMON_TIME       20
#define TM_SCENE_TICK_TIME   100
#define TM_RTC_TIME          5000
#define TM_BLINK_TIME        2500

void Timer_CreateTask(u8 id,
                             u32 time,
                             void(*action)(void*),
                             void *para,
                             s16 loop,
                             bool accurate);
void Timer_InterruptRun(void);
void Timer_DeleteTask(u8 id);
void Timer_TaskRun(void);
void Timer_ResetTask(u8 id);
void Timer_PauseTask(u8 id);
void Timer_ResumeTask(u8 id);
s8 Timer_GetTimerStatus(u8 id);
void Timer_Init(void);
#if(ENABLE_SYSTICK > 0) 
void Timer_GetSysTick(u32 *lastTick);
u32 Timer_GetIntervalTime(u32 lastTick);
#endif

#endif









